﻿using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;

namespace Glorysoft.EAP.EAPwell.web
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            //配置Mvc + json 序列化
            services.AddMvc(options => { options.EnableEndpointRouting = false; })
                    .SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
                        .AddNewtonsoftJson(options =>
                        {
                            options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
                            options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm";
                        });
        }

        public void Configure(IApplicationBuilder app)
        {
            
            
            app.UseMvc(s =>
            {
                
                s.MapRoute("default", "{controller}/{action}/{id?}", "test/index");
            });
           
            app.Run(context =>
            {
                return context.Response.WriteAsync("Hello world");
            });
      
        }
    }
}
